package org.example.schoolbus.controller;

import org.example.schoolbus.entity.ResultBody;
import org.example.schoolbus.service.FeedBackUService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/Submitmessage")
@CrossOrigin(origins = "*")
public class FeedBackUController {
    @Autowired
    private FeedBackUService feedBackUService;
    @RequestMapping("/FeedBackUser")
    public ResultBody FeedBackUser(@RequestBody Map<String, Object> map) {
       String  feedback_message = map.get("feedback_message").toString();
       String  userphone = map.get("userphone").toString();
       if(feedBackUService.FeedBackUser(feedback_message,userphone)>0)
       {
           return new ResultBody(200,"反馈成功",true);
       }
       else
           return new ResultBody(400,"反馈失败",false);
    }
}
